package com.hc.componentspringboot.mapper;


import com.hc.componentspringboot.bean.Comment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 基于注解的方式
 */
public interface CommentMapper {
    @Select("select * from t_comment where id=#{id}")
    Comment findById(Integer id);

    @Insert("insert into t_comment (article_id,content,author) values (#{articleId},#{content},#{author})")
    Integer insertComment(Comment comment);

    @Update("update t_comment set content=#{content} where id=#{id}")
    Integer updataComment(Comment comment);

    @Delete("delete from t_comment where id=#{id}")
    Integer deleteComment(Integer id);
}
